//
//  @ Project : Galaxy Star Trading System
//  @ File Name : MarginRate.cpp
//  @ Date : 2014/9/5
//  @ Author :
//
//
#include "../StdInc.h"

namespace GSTrader
{
	namespace TradeBase
	{
		CMarginRate::CMarginRate() : m_nInstrumentId(-1), m_dShortMarginRatioByVolume(0), m_strInstrumentId(""), m_strExchangeId(""),
			m_dLongMarginRatioByMoney(0), m_dLongMarginRatioByVolume(0), m_dShortMarginRatioByMoney(0), m_nHedgeFlag(0), m_nProviderId(-1)
		{

		}

		CMarginRate::~CMarginRate()
		{

		}

		CMarginRate::CMarginRate(const CMarginRate& r)
		{
			m_nInstrumentId = r.m_nInstrumentId;
			m_strInstrumentId = r.m_strInstrumentId;
			m_strExchangeId = r.m_strExchangeId;
			m_nHedgeFlag = r.m_nHedgeFlag;
			m_dLongMarginRatioByMoney = r.m_dLongMarginRatioByMoney;
			m_dLongMarginRatioByVolume = r.m_dLongMarginRatioByVolume;
			m_dShortMarginRatioByMoney = r.m_dShortMarginRatioByMoney;
			m_dShortMarginRatioByVolume = r.m_dShortMarginRatioByVolume;
		}

		void CMarginRate::Serialize(CArchiveEx& ar)
		{
			if (ar.IsStore())
			{
				ar << m_strInstrumentId;
				ar << m_strExchangeId;
				ar << m_nHedgeFlag;
				ar << m_dLongMarginRatioByMoney;
				ar << m_dLongMarginRatioByVolume;
				ar << m_dShortMarginRatioByMoney;
				ar << m_dShortMarginRatioByVolume;
			}
			else
			{
				ar >> m_strInstrumentId;
				ar >> m_strExchangeId;
				ar >> m_nHedgeFlag;
				ar >> m_dLongMarginRatioByMoney;
				ar >> m_dLongMarginRatioByVolume;
				ar >> m_dShortMarginRatioByMoney;
				ar >> m_dShortMarginRatioByVolume;
			}
		}
	}
}